﻿namespace AnyOffice.general.status_bar
{
    using AjaxPro;
    using AnyOffice.Components;
    using AnyOffice.DAL;
    using log4net;
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Reflection;

    public class AjaxMethods
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        [AjaxMethod]
        public string GetSms()
        {
            int num = 0;
            int num2 = 0;
            try
            {
                SqlConnection connection = new SqlConnection(ConfigManager.ConnectionString);
                new SmsDao().SmsCheck(connection, HttpContext.Current.User.Identity.Name, HttpContext.Current.Request.UserHostAddress, ref num, ref num2);
                if (connection.State == ConnectionState.Open) connection.Close();
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled) log.Error("", exception);
            }
            return (num.ToString() + "-" + num2.ToString());
        }
    }
}

